home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2005 November / WNnov2005.iso / Windows / Equipement / hMailServer / hMailServer-4.1-Build-136.exe / {app} / PHPWebAdmin / services.php < prev    next >
PHP Script  |  2005-05-30  |  4KB  |  108 lines

  1. <?php
  2. /*
  3. ** $Id: services.php,v 1.5 2005/05/30 18:31:43 hmailserver Exp $
  4. **
  5. **    hMailServer - Web interface
  6. **
  7. **    File formatted using TAB size 4
  8. **
  9. **    Get hMailserver at http://www.hmailserver.com
  10. **
  11. **    Author: Steen Rab°l <srabol@mail.tele.dk>
  12. **    Copyright (c) 2004, Steen Rab°l <srabol@mail.tele.dk>
  13. **
  14. **  This program is free software; you can redistribute it and/or modify
  15. **  it under the terms of the GNU General Public License as published by
  16. **  the Free Software Foundation; either version 2 of the License, or
  17. **  (at your option) any later version.
  18. **
  19. **  You may not change or alter any portion of this comment or credits
  20. **  of supporting developers from this source code or any supporting
  21. **  source code which is considered copyrighted (c) material of the
  22. **  original comment or credit authors.
  23. **
  24. **  This program is distributed in the hope that it will be useful,
  25. **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  27. **  GNU General Public License for more details.
  28. **
  29. **  You should have received a copy of the GNU General Public License
  30. **  along with this program; if not, write to the Free Software
  31. **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  32. **
  33. */
  34.  
  35. if (hmailGetAdminLevel() != 2)
  36.     hmailHackingAttemp();
  37.     
  38. $serverstate    = $obBaseApp->ServerState();
  39. $function        = hmailGetVar("function","");
  40. $obSettings        = $obBaseApp->Settings();
  41. $obUtilities    = $obBaseApp->Utilities();
  42. $hmailSmarty->assign("servertype","hMailServer");
  43.  
  44. switch($function)
  45. {
  46.     case "startserver":
  47.         $obBaseApp->Start(); // Start server
  48.         sleep(2);
  49.         header("refresh:0 url=index.php?page=services");
  50.         exit();
  51.         break;
  52.  
  53.     case "stopserver":
  54.         $obBaseApp->Stop(); // Stop server - POP3 server
  55.         sleep(2);
  56.         header("refresh:0 url=index.php?page=services");
  57.         exit();
  58.         break;
  59.  
  60.     case "save":
  61.  
  62.         $obSettings->serviceIMAP = (hmailGetVar("ServerIMAP") == 1 ? true : false);
  63.         $obSettings->serviceSMTP = (hmailGetVar("ServerSMTP") == 1 ? true : false);
  64.         $obSettings->servicePOP3 = (hmailGetVar("ServerPOP3") == 1 ? true : false);
  65.         break;
  66.  
  67.     default:
  68.         break;
  69. }
  70.  
  71. switch($serverstate)
  72. {
  73.     case 1:
  74.         $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_stopped"));
  75.         $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("start_server"));
  76.         $hmailSmarty->assign("buttonaction","startserver");
  77.         break;
  78.  
  79.     case 2:
  80.         $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_startpending"));
  81.         $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
  82.         $hmailSmarty->assign("buttonaction","stopserver");
  83.         break;
  84.  
  85.     case 3:
  86.         $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_running"));
  87.         $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
  88.         $hmailSmarty->assign("buttonaction","stopserver");
  89.         break;
  90.  
  91.     case 4:
  92.         $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_stoppending"));
  93.         $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
  94.         $hmailSmarty->assign("buttonaction","stopserver");
  95.         break;
  96.  
  97.     default:
  98.         $hmailSmarty->assign("serverstate", hmailGetLocaleText("server_unknownstate"));
  99.         $hmailSmarty->assign("buttonaction_value",hmailGetLocaleText("stop_server"));
  100.         $hmailSmarty->assign("buttonaction","stopserver");
  101.         break;
  102. }
  103.  
  104. $hmailSmarty->assign("smtpcheck",($obSettings->ServiceSMTP == true ? "checked" : ""));
  105. $hmailSmarty->assign("pop3check", ($obSettings->ServicePOP3 == true ? "checked" : ""));
  106. $hmailSmarty->assign("imapcheck" , ($obSettings->ServiceIMAP == true ? "checked" : ""));
  107. $hmailSmarty->assign("pagecontent", $hmailSmarty->fetch('services.tpl'));
  108. ?>